Dynomotion

Group: DynoMotion Message: 2170 From: himykabibble Date: 11/8/2011
Subject: Back To Tool Length Comp....
Looking into the interpreter code some more, and thinking about what I really need, I don't think I need to modify the existing code that juggles offsets for G43/G49. The difference in my situation is for a "normal" machine, G43 and G49 need only change the Z axis offset, and the next move will take that new offset into account, and move to the correct place. What I need is to instead MOVE the A axis (knee) to a new position, corresponding to the new tool length. The A axis is NEVER used in any program, so I can translate G43/G49 into simple A axis moves, and never mess with offsets at all.

So, what I need in convert_tool_length_offset boils down to:

static int convert_tool_length_offset( /* ARGUMENTS */
int g_code, /* g_code being executed (G_43 or
G_49) */
block_pointer block, /* pointer to a block of RS274/NGC
instructions */
setup_pointer settings)
{ /* pointer to machine settings */
static char name[] = "convert_tool_length_offset";
int index;
if (g_code == G_49) {
//Move A Axis to 0.000 Here
} else if (g_code == G_43) {
index = block->h_number;
CHK((index == -1), NCE_OFFSET_INDEX_MISSING);
// Move A Axis to settings->tool_table[index].length Here
} else
ERM(NCE_BUG_CODE_NOT_G43_OR_G49);
return RS274NGC_OK;


The only thing that's not clear to me is HOW I make that move happen. It appears to me I can use the STRAIGHT_TRAVERSE function?

Regards,
Ray L.
Group: DynoMotion Message: 2171 From: Tom Kerekes Date: 11/8/2011
Subject: Re: Back To Tool Length Comp....
Hi Brad,
 
I would think so.  I think you would need to command the other axes to their current positions so they would not move and then after the move change the AA_current position to be the new position, otherwise the next move of any kind would just move it back.
 
One thing that concerns me is that maybe G43/49 are not in the proper modal group that should cause motion and I don't know what the implications of that would be.
 
Try it!
 
Regards
TK 
 

Group: DynoMotion Message: 2172 From: himykabibble Date: 11/8/2011
Subject: Re: Back To Tool Length Comp....
Tom,

Thanks, I'll give it a shot as soon as my VS2008 shows up.

Am I correct in thinking that on a "normal" CNC machine, G43 and G49 would NOT cause any axis motion until some other block was executed that caused a move?

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Brad,
>  
> I would think so.  I think you would need to command the other axes to their current positions so they would not move and then after the move change the AA_current position to be the new position, otherwise the next move of any kind would just move it back.
>  
> One thing that concerns me is that maybe G43/49 are not in the proper modal group that should cause motion and I don't know what the implications of that would be.
>  
> Try it!
>  
> Regards
> TK 
>  
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Tuesday, November 8, 2011 5:23 PM
> Subject: [DynoMotion] Back To Tool Length Comp....
>
>
>  
> Looking into the interpreter code some more, and thinking about what I really need, I don't think I need to modify the existing code that juggles offsets for G43/G49. The difference in my situation is for a "normal" machine, G43 and G49 need only change the Z axis offset, and the next move will take that new offset into account, and move to the correct place. What I need is to instead MOVE the A axis (knee) to a new position, corresponding to the new tool length. The A axis is NEVER used in any program, so I can translate G43/G49 into simple A axis moves, and never mess with offsets at all.
>
> So, what I need in convert_tool_length_offset boils down to:
>
> static int convert_tool_length_offset( /* ARGUMENTS */
> int g_code, /* g_code being executed (G_43 or
> G_49) */
> block_pointer block, /* pointer to a block of RS274/NGC
> instructions */
> setup_pointer settings)
> { /* pointer to machine settings */
> static char name[] = "convert_tool_length_offset";
> int index;
> if (g_code == G_49) {
> //Move A Axis to 0.000 Here
> } else if (g_code == G_43) {
> index = block->h_number;
> CHK((index == -1), NCE_OFFSET_INDEX_MISSING);
> // Move A Axis to settings->tool_table[index].length Here
> } else
> ERM(NCE_BUG_CODE_NOT_G43_OR_G49);
> return RS274NGC_OK;
>
> The only thing that's not clear to me is HOW I make that move happen. It appears to me I can use the STRAIGHT_TRAVERSE function?
>
> Regards,
> Ray L.
>
Group: DynoMotion Message: 2173 From: Tom Kerekes Date: 11/8/2011
Subject: Re: Back To Tool Length Comp....
Hi Ray,
 
Yes I believe so, or something like a G0 in the same block.
 
TK

Group: DynoMotion Message: 2174 From: himykabibble Date: 11/8/2011
Subject: Re: Back To Tool Length Comp....
Well, here's what I'm going to try:

static int convert_tool_length_offset(
int g_code,
block_pointer block,
setup_pointer settings)
{
static char name[] = "convert_tool_length_offset";
int index;
double offset;

if (g_code == G_49) {
USE_TOOL_LENGTH_OFFSET(0.0);
settings->tool_length_offset = 0.0;
if (settings->length_offset_index > 1) {
// Don't allow G49 on tool #1
settings->length_offset_index = 1;
settings->AA_current = 0.0;
STRAIGHT_TRAVERSE(
settings->current_x,
settings->current_y,
settings->current_z,
settings->AA_current,
settings->BB_current,
settings->CC_current);
}
} else if (g_code == G_43) {
USE_TOOL_LENGTH_OFFSET(0.0);
settings->tool_length_offset = 0.0;
index = block->h_number;
CHK((index == -1), NCE_OFFSET_INDEX_MISSING);
if (index > 1) {
settings->length_offset_index = index;
offset = settings->tool_table[index].length;
settings->AA_current = offset;
STRAIGHT_TRAVERSE(
settings->current_x,
settings->current_y,
settings->current_z,
settings->AA_current,
settings->BB_current,
settings->CC_current);
}
} else
ERM(NCE_BUG_CODE_NOT_G43_OR_G49);
return RS274NGC_OK;
}

For a number of reasons, I don't allow tool length comp on tool #1. at least for now.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> Yes I believe so, or something like a G0 in the same block.
>  
> TK
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Tuesday, November 8, 2011 8:53 PM
> Subject: [DynoMotion] Re: Back To Tool Length Comp....
>
>
>  
> Tom,
>
> Thanks, I'll give it a shot as soon as my VS2008 shows up.
>
> Am I correct in thinking that on a "normal" CNC machine, G43 and G49 would NOT cause any axis motion until some other block was executed that caused a move?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Brad,
> >  
> > I would think so.  I think you would need to command the other axes to their current positions so they would not move and then after the move change the AA_current position to be the new position, otherwise the next move of any kind would just move it back.
> >  
> > One thing that concerns me is that maybe G43/49 are not in the proper modal group that should cause motion and I don't know what the implications of that would be.
> >  
> > Try it!
> >  
> > Regards
> > TK 
> >  
> >
> > From: himykabibble <jagboy@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Tuesday, November 8, 2011 5:23 PM
> > Subject: [DynoMotion] Back To Tool Length Comp....
> >
> >
> >  
> > Looking into the interpreter code some more, and thinking about what I really need, I don't think I need to modify the existing code that juggles offsets for G43/G49. The difference in my situation is for a "normal" machine, G43 and G49 need only change the Z axis offset, and the next move will take that new offset into account, and move to the correct place. What I need is to instead MOVE the A axis (knee) to a new position, corresponding to the new tool length. The A axis is NEVER used in any program, so I can translate G43/G49 into simple A axis moves, and never mess with offsets at all.
> >
> > So, what I need in convert_tool_length_offset boils down to:
> >
> > static int convert_tool_length_offset( /* ARGUMENTS */
> > int g_code, /* g_code being executed (G_43 or
> > G_49) */
> > block_pointer block, /* pointer to a block of RS274/NGC
> > instructions */
> > setup_pointer settings)
> > { /* pointer to machine settings */
> > static char name[] = "convert_tool_length_offset";
> > int index;
> > if (g_code == G_49) {
> > //Move A Axis to 0.000 Here
> > } else if (g_code == G_43) {
> > index = block->h_number;
> > CHK((index == -1), NCE_OFFSET_INDEX_MISSING);
> > // Move A Axis to settings->tool_table[index].length Here
> > } else
> > ERM(NCE_BUG_CODE_NOT_G43_OR_G49);
> > return RS274NGC_OK;
> >
> > The only thing that's not clear to me is HOW I make that move happen. It appears to me I can use the STRAIGHT_TRAVERSE function?
> >
> > Regards,
> > Ray L.
> >
>